type RandomStringConfig = {
  base: string;
  length: number;
};

function randomStringWithConfig({ base, length }: RandomStringConfig) {
  let str = '';
  for (let i = 0; i < length; i++) {
    str += base[Math.floor(Math.random() * length)];
  }
  return str;
}

export function randomString() {
  return randomStringWithConfig({
    base: 'abcdefghijklmnopqrstuvwxyz_0123456789-ABCDEFGHIJKLMNOPQRSTUVWXYZ',
    length: 17,
  });
}
